package com.zsl.swing.redis.desktop.type;

import java.util.Arrays;
import java.util.Optional;

public enum MainMenuEnum {
    SERVERS("servers"),OPTIONS("options"),OTHER("other"),
    ADD("添加"),UPDATE("修改"),READ("查看"),DELETE("删除"),
    FONT_SIZE_SET("设置字体大小"),DB_COUNT_SET("设置展示DB数量"), OTHER_GENERAL_SET("其他通用设置"),
    REWARD("打赏一个"), FEEDBACK("反馈"), REDIS_COMMAND("Redis命令");

    private String text;

    MainMenuEnum(String text){
        this.text = text;
    }

    public String getText(){
        return this.text;
    }


    public static MainMenuEnum getMenuEnum(String menuName){
        Optional<MainMenuEnum> first = Arrays.stream(values()).filter(m -> m.getText().equals(menuName)).findFirst();
        return first.isPresent()?first.get(): null;
    }
}
